<%@ page contentType="text/html; charset=UTF-8"%>

<%
	response.addHeader("P3P", "CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");
	
	String JSESSIONID = request.getSession().getId();//获取当前JSESSIONID （不管是从主域还是二级域访问产生）
	System.out.println("domainTo的JSESSIONID = " + JSESSIONID);

	String userId = (String)session.getAttribute("userId");
	if(userId == null) {
		System.out.println("第一次访问");
		session.setAttribute("userId","test");
	} else {
		System.out.println("第n次访问userId = " + userId);
	}
%>

JSESSIONID：<input type="text" value="<%=JSESSIONID%>" size="50"/> <br>
userId：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" value="<%=userId%>" />